<?php namespace Summer\Box\Updates;

use Schema;
use Winter\Storm\Database\Updates\Migration;

class BuilderTableCreateSummerBoxOrders extends Migration
{
    public function up()
    {
        Schema::create('summer_box_orders', function($table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();
            $table->timestamp('created_at')->nullable();
            $table->timestamp('updated_at')->nullable();
            $table->integer('item_id');
            $table->integer('sell_uid');
            $table->integer('buy_uid');
            $table->decimal('total', 14, 2);
            $table->decimal('xianjin_pay', 14, 2)->nullable()->default(0.00);
            $table->integer('xianjin_is_pay')->nullable()->default(0);
            $table->dateTime('xianjin_pay_at')->nullable();
            $table->decimal('jifen_pay', 14, 2)->nullable()->default(0.00);
            $table->integer('jifen_is_pay')->nullable()->default(0);
            $table->dateTime('jifen_pay_at')->nullable();
            $table->decimal('shangjia_pay', 14, 2)->nullable()->default(0.00);
            $table->integer('shangjia_is_pay')->nullable()->default(0);
            $table->dateTime('shangjia_pay_at')->nullable();
            $table->decimal('sell_money', 14, 2)->nullable()->default(0.00);
            $table->decimal('pre_money', 14, 2)->nullable()->default(0.00);
            $table->integer('status')->nullable();
            $table->string('status_slug')->nullable();
        });
    }
    
    public function down()
    {
        Schema::dropIfExists('summer_box_orders');
    }
}
